<?php
namespace Home\Model;
use Think\Model;
class categoryModel extends Model {
	public function getCate()
	{
		$arr = $this->select();

		$res = [];
		foreach ($arr as $v) {
			if ($v['fid']==0) {
				$res[]=$v;
			}
		}
		foreach ($res as $k => $v) {
			foreach ($arr as $va) {
				if ($va['fid']==$v['id']) {
					$res[$k]['son'][]=$va;
					// $res['num']='我是一维数组';
				}
			}
		}
		
		return $res;
	}

}


?>